const { merge } = require('webpack-merge')
const baseConfig = require('./config')
const TerserPlugin = require("terser-webpack-plugin");

module.exports = merge(baseConfig, {
    mode: 'production',
    // devtool: 'source-map',
    output: {
        filename: 'js/[name].[chunkhash:8].js',
        chunkFilename: 'js/[name].[chunkhash:8].chunk.js',
    },
    optimization: {
        minimizer: [
            new TerserPlugin({
                terserOptions: {
                    ecma: 5, // 强制使用 ES5
                    compress: {
                        drop_console: true // 移除 console 语句
                    }
                }
            })
        ]
    },
    module: {},
    plugins: [],
})
